<?php
	function currency_input($field_name) { ?>
	
	<select name="<?=$field_name;?>" id="<?=$field_name;?>">
	<?php 
	$QList = "SELECT * FROM main_settings_currency";
	$List = $GLOBALS['CONN']->db_array($QList);
	for ($l = 1; $l <= $List[0]; $l++) { ?>
		
	<option value="<?=$List[$l]['ref'];?>" <?php if (isset($_POST[$field_name]) && $List[$l]['ref'] == $_POST[$field_name]) { print "selected";} ?>><?=$List[$l]['icon'];?> <?=$List[$l]['name'];?></option>
	<?php
	} ?>
    </select>
	
<?php	}

	function currency_output($ref,$out) { ?>
	
	<?php 
	$QList = "SELECT * FROM main_settings_currency WHERE ref = '{$ref}'";
	$List = $GLOBALS['CONN']->db_array($QList);
	return $List[1][$out];
	
	}

	function currency_select($field_name,$value) { ?>
	
	<select name="<?=$field_name;?>" id="<?=$field_name;?>">
	<?php 
	$QList = "SELECT * FROM main_settings_currency WHERE ref = '{$value}'";
	$List = $GLOBALS['CONN']->db_array($QList);
	for ($l = 1; $l <= $List[0]; $l++) { ?>
	<option value="<?=$List[$l]['ref'];?>"<?php if (isset($_POST[$field_name]) && $List[$l]['ref'] == $_POST[$field_name]) { print "selected";} ?>><?=$List[$l]['icon'];?> <?=$List[$l]['name'];?></option>
	<?php } ?>
    </select>
<?php
	}

	function currency_exclude($field_name,$value) { ?>
	
	<select name="<?=$field_name;?>" id="<?=$field_name;?>">
	<?php 
	$QList = "SELECT * FROM main_settings_currency WHERE ref != '{$value}'";
	$List = $GLOBALS['CONN']->db_array($QList);
	for ($l = 1; $l <= $List[0]; $l++) { ?>
	<option value="<?=$List[$l]['ref'];?>"<?php if (isset($_POST[$field_name]) && $List[$l]['ref'] == $_POST[$field_name]) { print "selected";} ?>><?=$List[$l]['icon'];?> <?=$List[$l]['name'];?></option>
	<?php } ?>
    </select>
<?php } ?>
	